home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / source / fbm12s.lha / fbthin.c < prev    next >
C/C++ Source or Header  |  1994-07-18  |  2KB  |  79 lines

  1. /*****************************************************************
  2.  * fbthin.c: FBM Release 1.2 19-Apr-93 Michael Mauldin
  3.  *
  4.  * Copyright (C) 1989-1993 by Michael Mauldin.  Permission is granted
  5.  * to use this file in whole or in part for any purpose, educational,
  6.  * recreational or commercial, provided that this copyright notice
  7.  * is retained unchanged.  This software is available to all free of
  8.  * charge by anonymous FTP and in the UUNET archives.
  9.  *
  10.  * fbthin.c: Sharpen an image by using a Laplacian edge enhancement
  11.  *
  12.  * USAGE
  13.  *    % fbthin [ flags ] arguments
  14.  *
  15.  * EDITLOG
  16.  *    LastEditDate = Mon Jun 25 00:04:40 1990 - Michael Mauldin
  17.  *    LastFileName = /usr2/mlm/src/misc/fbm/fbthin.c
  18.  *
  19.  * HISTORY
  20.  * 19-Apr-93  Michael Mauldin (mlm) at Carnegie-Mellon University
  21.  *    Created from fbsharp.c
  22.  *****************************************************************/
  23.  
  24. # include <stdio.h>
  25. # include <math.h>
  26. # include "fbm.h"
  27.  
  28. # define USAGE "fbthin [ -<type> ] < 1bit > 1bit"
  29.  
  30. #ifndef lint
  31. static char *fbmid =
  32. "$FBM fbthin.c <1.2> 19-Apr-93 (C) 1989-1993 by Michael Mauldin, source \
  33. code available free from MLM@CS.CMU.EDU and from UUNET archives$";
  34. #endif
  35.  
  36. main (argc, argv)
  37. char *argv[];
  38. { FBM input, output;
  39.   int outtype = DEF_8BIT;
  40.   register int i, j;
  41.  
  42.   /* Get the options */
  43.   while (--argc > 0 && (*++argv)[0] == '-')
  44.   { while (*++(*argv))
  45.     { switch (**argv)
  46.       { 
  47.     case 'A':    outtype = FMT_ATK; break;
  48.     case 'B':    outtype = FMT_FACE; break;
  49.     case 'F':    outtype = FMT_FBM; break;
  50.     case 'G':    outtype = FMT_GIF; break;
  51.     case 'I':    outtype = FMT_IFF; break;
  52.     case 'J':    outtype = FMT_JPEG; break;
  53.     case 'L':    outtype = FMT_LEAF; break;
  54.     case 'M':    outtype = FMT_MCP; break;
  55.     case 'P':    outtype = FMT_PBM; break;
  56.     case 'R':    outtype = FMT_RLE; break;
  57.     case 'S':    outtype = FMT_SUN; break;
  58.     case 'T':    outtype = FMT_TIFF; break;
  59.     case 'X':    outtype = FMT_X11; break;
  60.     case 'Z':    outtype = FMT_PCX; break;
  61.     default:        fprintf (stderr, "%s\n", USAGE);
  62.                         exit (1);
  63.       }
  64.     }
  65.   }
  66.  
  67.   /* Clear the memory pointers so alloc_fbm wont be confused */
  68.   input.cm  = input.bm  = (unsigned char *) NULL;
  69.   output.cm = output.bm = (unsigned char *) NULL;
  70.  
  71.   /* Read the image first */
  72.   if (read_bitmap (&input, (char *) NULL) &&
  73.       thin_fbm (&input, &output) &&
  74.       write_bitmap (&output, stdout, outtype))
  75.   { exit (0); }
  76.   else
  77.   { exit (1); }
  78. }
  79.